package common.controls.tilelist
{
	import cn.flashk.controls.List;
	import cn.flashk.controls.interfaces.ITileListItemRender;
	
	import flash.display.Sprite;
	import flash.events.MouseEvent;
	
	/**  
	 * 
	 * @author carrey
	 * */ 
	public class MyTileListItemRender extends Sprite implements ITileListItemRender
	{
		
		private var _data:Object;
		private var _height:Number = 128;
		private var _width:Number = 107;
		private var _list:List;
		private var _selected:Boolean = false;
		
		public function MyTileListItemRender()
		{
			
			
			
			this.addEventListener(MouseEvent.MOUSE_OVER,showOver);
			this.addEventListener(MouseEvent.MOUSE_OUT,showOut);
		}
		
		protected function showOver(event:MouseEvent=null):void
		{
			if(_selected == false){
				
			}
		}
		
		public function showSelect(event:MouseEvent=null):void
		{
			
		}
		
		protected function showOut(event:MouseEvent =null):void
		{
			if(_selected == false){
				
			}
		}
		public function set list(value:List):void{
			_list = value;
		}
		public function set data(value:Object):void{
			_data = value;
			
			if(value.view != null)
			{
				this.addChild(value.view);
				_width = value.view.width;
				_height = value.view.height;
			}
		}
		public function get data():Object{
			return _data;
		}
		public function get itemHeight():Number{
			return _height;
		}
		public function get itemWidth():Number{
			return _width;
		}
		public function setSize(newWidth:Number, newHeight:Number):void{
			
			
			if(_selected == true){
				showSelect();
			}
		}
		public function set selected(value:Boolean):void{
			_selected = value;
			if(_selected == true){
				showSelect();
			}else{
				showOut();
			}
		}
		public function get selected():Boolean{
			return _selected;
		}
	}
}
